//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
import Popup from '../internal/popup'
export default {
mixins: [Popup],
name: 'mu-dialog',
props: {
dialogClass: {
type: [String, Array, Object]
},
title: {
type: String
},
scrollable: {
type: Boolean,
default: false
}
},
computed: {
bodyStyle () {
return {
'overflow-x': 'hidden',
'overflow-y': this.scrollable ? 'auto' : 'hidden',
'-webkit-overflow-scrolling': 'touch',
'max-height': this.scrollable ? this.maxDialogContentHeight + 'px' : 'none'
}
},
showFooter () {
return this.$slots && this.$slots.actions && this.$slots.actions.length > 0
}
},
data () {
return {
maxDialogContentHeight: null
}
},
mounted () {
this.setMaxDialogContentHeight()
},
updated () {
setTimeout(() => {
this.setMaxDialogContentHeight()
}, 0)
},
methods: {
setMaxDialogContentHeight () {
let maxDialogContentHeight = window.innerHeight - 2 * 64
if (this.$refs.footer) maxDialogContentHeight -= this.$refs.footer.offsetHeight
if (this.title) maxDialogContentHeight -= this.$refs.title.offsetHeight
this.maxDialogContentHeight = maxDialogContentHeight
},
overlayClick () {
this.$emit('close', 'overlay')
},
escPress () {
this.$emit('close', 'esc')
},
show () {
this.$emit('show')
},
hide () {
this.$emit('hide')
}
}
}
|